<?php
$startDate = $this->getRequest()->getParam('start_date','');
$endDate = $this->getRequest()->getParam('end_date','');
$is_salt = $this->getRequest()->getParam('is_salt');
$regions = $this->getItemCollection();
?>

<div class="print">
	<div class="report-header">
		<h2>铺市订单汇总表</h2>
		<div class="search-box">
			<form name="report_form" id="report_form" action="" method="get">
				<table class="data-table" style="width:800px">
					<tr>
						<td>
							统计日期:<input type="text" name="start_date" id="start_date" value="<?php echo $startDate;?>" class="laydate-icon"/> 至 <input type="text" name="end_date" id="end_date" value="<?php echo $endDate;?>" class="laydate-icon"/>
						</td>
					</tr>
					<tr>
						<td class="label"><label>商品类型:</label>
							<select name="is_salt">
								<option value="0" <?php if($is_salt==0) echo 'selected';?>>全部</option>
								<option value="1" <?php if($is_salt==1) echo 'selected';?>>非盐</option>
								<option value="2" <?php if($is_salt==2) echo 'selected';?>>盐</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							<input type="submit" value="统计" name="apply" id="apply"/>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		laydate({
		    elem: '#start_date',
		    format: 'YYYY-MM-DD',
		    event: 'focus'
		});
		laydate({
		    elem: '#end_date',
		    format: 'YYYY-MM-DD',
		    event: 'focus'
		});
	</script>
	<div class="order-print">
		<table class="data-table">
			<tr>
				<td>地区</td>
				<td>新用户</td>
				<td>新用户订单</td>
				<td>老用户订单</td>
				<td>订单总数</td>
				<td>新下单用户数</td>
				<td>老下单用户数</td>
				<td>用户总数</td>
				<td>订单金额合计</td>
				<td>平均</td>
			</tr>
			<?php foreach($regions as $key=>$data):?>
			<tr>
				<td><?php echo $data['name']; ?></td>
				<td><?php echo $data['new_customer']; ?></td>
				<td><?php echo $data['new_customer_order']; ?></td>
				<td><?php echo $data['old_customer_order']; ?></td>
				<td><?php echo $data['order_count']; ?></td>
				<td><?php echo $data['new_customer_count']; ?></td>
				<td><?php echo $data['old_customer_count']; ?></td>
				<td><?php echo $data['customer_count']; ?></td>
				<td><?php echo $data['order_total']?$data['order_total']:0; ?></td>
				<?php $perOrder = $data['order_total']/$data['customer_count'];?>
				<td><?php echo number_format($perOrder,2); ?></td>
			</tr>
			<?php endforeach;?>
		</table>
	</div>
</div>
<script type="text/javascript">
(function($){
})(jQuery);
</script>